﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using SilverlightApplication1.GdiService;
using System.Collections.ObjectModel;

namespace SilverlightApplication1
{
    public class ShopViewModel : BaseViewModel
    {
        GdiStoryServiceClient _client = new GdiStoryServiceClient();
        public ShopViewModel()
        {
            _client.GetProductsCompleted += new EventHandler<GetProductsCompletedEventArgs>(_client_GetProductsCompleted);
            if (DesignerProperties.IsInDesignTool)
            {

            }
            else
            {
                _client.GetProductsAsync();
            }
        }

        void _client_GetProductsCompleted(object sender, GetProductsCompletedEventArgs e)
        {
            Products = e.Result;
        }

        private ObservableCollection<Product> _products = new ObservableCollection<Product>();

        public ObservableCollection<Product> Products
        {
            get
            {
                return _products;
            }
            set
            {
                _products = value;
                RaisePropertyChanged("Products");
            }
        }
    }
}
